package TestClasser;

import static org.junit.Assert.*;


import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

import DBLayer.DBSupplier;
import ModelLayer.Supplier;

public class DBSupplierTest {

	private DBSupplier dbObject;
	@BeforeClass
	public static void setUpBeforeClass() throws Exception {
	}

	@Before
	public void setUp() throws Exception {
		dbObject = new DBSupplier();
	}

	@After
	public void tearDown() throws Exception {
	}






	@Test
	public void testSearchSupplierName() 
	{ 
		System.out.println("Finder en supplier via name");
		Supplier suppObject = dbObject.searchSupplierName("Cowfars", false);
		if(suppObject != null)
		{
			System.out.println(suppObject.getSupplierId());
			System.out.println("");
		}
		else {
			fail("Supplier not found");
		}
	}

	@Test
	public void testSearchSupplierId() 
	{
		System.out.println("Finder en supplier vi supplierID");
		Supplier supObject = dbObject.findSupplier(1, false);
		if(supObject != null)
		{
			System.out.println(supObject.getSupplierName());
			System.out.println("");
		}
		else {
			fail("Supplier not found");
		}
	}
}